package com.lyf.design.learn.designmodel.strategy.sortsample.demo1;

/**
 * @AUTHOR LYF
 * @DATE 2022/6/2
 * @VERSION 1.0
 * @DESC
 */
public class Cat extends Animal implements Comparable<Cat>{
    @Override
    void call() {
        System.out.println("Cat is miao miao ....");
    }
    @Override
    public int compareTo(Cat t) {
        float cat0 = this.weight;
        float cat1 = t.weight;
        if(cat0>cat1)
            return 1;
        else if(cat0<cat1)
            return -1;
        return 0;
    }

    public Cat() {
        super();
    }

    public Cat(float weight) {
        super(weight);
    }

    @Override
    public String toString() {
        return "Cat{" +
                "weight=" + weight +
                '}';
    }
}
